#include "network_context.h"

int EchoCallback(void* buffer, size_t length, int clientFd, void* userData) {
  printf("server: Received data: %s\n", (char*)buffer);
  char* message = "Hello, Client!";
  network::NetworkContext::Send(clientFd, message, strlen(message));
  printf("server: Sent data: %s\n", message);
  return 0;
}

int main() {
  network::NetworkContext server("127.0.0.1", 8080,
                                 network::NetworkContext::NETWORK_PROTOCOL_TCP);
  server.SetCallback(EchoCallback);

  if (server.StartServer(network::NetworkContext::VernoxSelect) == 0) {
    printf("Server is running...\n");
  }

  return 0;
}
